A5.buttonshtml Method
Syntax
Arguments
- idstring
The ID to put on the BUTTON element.
- settingsobject
The settings to use to create the button.
- themestring
The theme to use on the button.
- layoutstring
The layout of the button. A value of "icon text" (the default) or "text icon" which will layout the "icon" and "html" horizontally. A value of "icon" or "text" will only use only "icon" or "text" in the layout. A value of "icon/text" or "text/icon" will layout the "icon" and "html" vertically. A value of "icon-text" or "text-icon" will layout the "icon" and "html" horizontally, but align them to the left and right of the button with any additional width consumed in the center of the button. In all cases the "icon" will be automatically dropped if none is specified.
- htmlstring
The HTML to put in the button.
- iconstring
The icon to put in the button. See A5.u.icon.
- hoverIconstring
The icon to put in the button when the user hovers over it. See A5.u.icon.
- pressedIconstring
The icon to put in the button when it is pressed. See A5.u.icon.
- selectedIconstring
The icon to put in the button when it is selected. See A5.u.icon.
- disabledIconstring
The icon to put in the button when it is disabled. See A5.u.icon.
- disabledSelectedIconstring
The icon to put in the button when it is disabled and selected. See A5.u.icon.
- tipstring
The TITLE attribute to put in the button that will appear as a tool tip when the user hovers over the button.
- stylestring
The CSS to put on the button.
- classNamestring
The class name to put on the button.
- hoverClassNamestring
The class name to put on the button when the user hovers over it.
- pressedClassNamestring
The class name to put on the button when the user presses it.
- selectedClassNamestring
The class name to put on the button when the button is selected.
- disabledClassNamestring
The class name to put on the button when the button is disabled.
- disabledSelectedClassNamestring
The class name to put on the button when the button is disabled and selected.
- iconStylestring
The CSS to put on the button icon.
- iconClassNamestring
The class name to put on the button icon.
- attributesstring
Any other HTML attributes that want to be included in the BUTTON tag.
- statestring
The state the button should be in. Values can be "normal" (the default), "selected", "pressed", "disabled" or "disabled-selected".
- templateSafeboolean
If true then the returned HTML will be template safe. This will escape sepcial template characters (see A5.u.template). This only need to be done if the button is being injected into a template before the template is parsed. If the A5.buttons.html method is being called from inside a template, then it does not need to be made template safe. The default value is false.
Returns
- htmlstring
The resulting HTML for the given button settings.
Description
Create a BUTTTON HTML string.
Discussion
This method will create a BUTTON HTML string based on the passed in settings. The passed in settings are the same as the A5.Button settings. Unlike the A5.Button class, the A5.buttons.html method will not bind events or other javascript logic beyond basic UI interactions such as hover class name changes. This method can be useful for creating themed buttons inside of a template (see A5.u.template).
Example
// create a BUTTON tag that uses the "Alpha" theme with the text "Save" and has an attribute "a5-item" with a value of "save" var html = A5.buttons.html('saveButton',{theme: 'Alpha', html: 'Save'},'a5-item="save"');